import os.path
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# 准备配置项
options = webdriver.ChromeOptions()
# 准备下载路径
download = os.path.dirname(os.path.abspath(__file__)) + "/download"
prefs = {
    "profile.default_content_settings.popups":0, # 取消弹窗
    "download.default_directory":download      # 设置保存位置
}
options.add_experimental_option("prefs", prefs)
# 打开浏览器(设置options),请求测试网址
driver = webdriver.Chrome()
driver.get("https://pc.weixin.qq.com/")
driver.maximize_window()
# 下载文件
# 定位文件,执行点击操作
driver.find_element(By.ID, "downloadButton").click()